﻿<Window x:Class="SimpleDbBrowser.Windows.OptionsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding DisplayName}"  MinWidth="400"
        x:Name="This"
        DataContext="{Binding ElementName=This, Path=OptionsModel}" 
        mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        d:DesignWidth="{Binding ElementName=This, Path=MinWidth}" 
        WindowStartupLocation="CenterOwner" MinHeight="125" SizeToContent="WidthAndHeight" ShowInTaskbar="False">
    <Grid Style="{StaticResource LayoutGrid}">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <Label Grid.Column="0" Grid.Row="0" Content="Access key:" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
        <TextBox x:Name="txtAccessKey" Grid.Column="1" Grid.Row="0" Text="{Binding Path=AccessKey, UpdateSourceTrigger=PropertyChanged}" />
        
        <Label Grid.Column="0" Grid.Row="1" Content="Secret key:" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
        <TextBox x:Name="txtSecretKey" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SecretKey, UpdateSourceTrigger=PropertyChanged}" />
        
        <GroupBox Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="2" MinHeight="42">
            
            <GroupBox.Header>
                <CheckBox Content="Manual proxy settings" IsChecked="{Binding Path=EnableConnectionSettings}" Background="Transparent" />
            </GroupBox.Header>
            
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="Proxy host:" IsEnabled="{Binding EnableConnectionSettings}" />
                <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding ProxyHost}" IsEnabled="{Binding EnableConnectionSettings}" />

                <Label Grid.Row="1" Grid.Column="0" Content="Proxy port:" IsEnabled="{Binding EnableConnectionSettings}" />
                <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding ProxyPort}" IsEnabled="{Binding EnableConnectionSettings}" />
            </Grid>
        </GroupBox>
        
        <StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" FlowDirection="LeftToRight" HorizontalAlignment="Right">
            <Button 
                Content="OK" 
                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=CommitChanges}" 
                IsDefault="True" />
            
            <Button 
                Content="Cancel" 
                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Path=CancelChanges}" 
                IsCancel="True" />
        </StackPanel>
        
    </Grid>
</Window>
